package com.heaven.ojcodesandbox.docker;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.InspectImageResponse;
import com.github.dockerjava.api.command.PullImageCmd;
import com.github.dockerjava.api.command.PullImageResultCallback;
import com.github.dockerjava.api.model.Image;
import com.github.dockerjava.api.model.PullResponseItem;
import com.github.dockerjava.core.DockerClientBuilder;
import com.github.dockerjava.core.DockerClientImpl;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description TODO
 * @Author HeavenDirt
 * @Date 2024/7/28 16:25
 */
@Slf4j
public class DockerDemo {
    public static void main(String[] args) throws InterruptedException {
        //获取默认DockerClient
        DockerClient dockerClient = DockerClientBuilder.getInstance().build();
        String image = "openjdk:8-alpine";
        boolean contains = dockerClient.listImagesCmd().exec().contains(image);
        System.out.println(contains);
    }
}
